import axios from 'axios';

const API_URL = 'http://192.168.33.201:3000';

export const startVideoDetection = (videoFile) => {
  const formData = new FormData();
  formData.append('video', videoFile);
  
  return axios.post(`${API_URL}/detect/video`, formData)
    .then(response => response.data)
    .catch(error => {
      console.error("Error detecting video:", error);
      throw error;
    });
};

export const singleDetection = (action) => {
  return axios.get(`${API_URL}/detect/${action}`)
    .then(response => response.data)
    .catch(error => {
      console.error("Error detecting action:", error);
      throw error;
    });
};
